const { mock, Random } = require('mockjs')
const { image } = require('mockjs/src/mock/random')
const mockUserList = mock({
  'users|10-20': [{
    'id|+1': 1,
    'username': function (){return mock(/\w{4,5}/)},
    'password': 'root',
    'nickname': '@cname',
    'avatar': function () {
      return image('200x100', '#00405d', '#FFF', Random.cword(2, 5))
    },
    'role': mock(/[012]/),
    'phone': mock(/1\d{10}/),
    'address': '@county(true)',
    'saying': '@ctitle',
    'locked|0-1': 0,//是否锁定
    'gender': '@cname',
    'age|18-60': 1,
    'email': '@email',
    'create_time': '@datetime',
    'create_by': '@cname',
    'update_time': '@now',
    'update_by': '@cname',
    'deleted|0-1': 0,

  }]
})

const mockLogin = mock({
    'token':'token-admin'
})

const mockInfo = mock({
    'username':'admin-mock',
    'role':['admin']
})

const mockLoginCode = mock({
    'loginCode':function () {
        return image('200x100', '#00405d', '#FFF', Random.cword(2, 5))
    },
}).loginCode
module.exports = {
  mockUserList,mockLogin,mockInfo,mockLoginCode
}
